export default class AppStore {
  public customHeaderHeight = 41

  public getSystemParam() {
    const { safeAreaInsets, windowHeight, windowTop, windowBottom } = uni.getSystemInfoSync()
    const topOccludedAreaHeight = safeAreaInsets?.top ?? 0
    const completeSafeHeight = topOccludedAreaHeight + this.customHeaderHeight

    const safeArea = safeAreaInsets
    // 当获取不到时，默认状态栏高度为44(px)
    const safeAreaTop = safeArea?.top ?? 44
    const safeAreaBottom = safeArea?.bottom ?? 0
    const viewHeight = windowHeight + windowTop + windowBottom
    const customHeaderHeight = this.customHeaderHeight
    return {
      completeSafeHeight,
      safeArea,
      safeAreaTop,
      safeAreaBottom,
      viewHeight,
      customHeaderHeight,
      topOccludedAreaHeight
    }
  }
}
